<template>
  <div class="bar-chart" ref="barChartRef">BarChart</div>
</template>

<script lang="ts">
export default {
  name: "BarChart",
};
</script>

<script lang="ts" setup>
import * as echarts from "echarts";
import { onMounted, ref } from "vue";

const barChartRef = ref();

onMounted(() => {
  const myEchart = echarts.init(barChartRef.value);
  const option = {
    xAxis: {
      data: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
      show: false,
    },
    yAxis: {
      show: false,
    },
    series: {
      type: "bar",
      data: [25, 20, 29, 18, 23, 25, 20, 29, 18, 23, 30, 15],
    },
    grid: {
      left: 0,
      right: 0,
      top: 10,
      bottom: 0,
    },
  };
  myEchart.setOption(option);
});
</script>

<style scoped>
.bar-chart {
  width: 100%;
  height: 100%;
}
</style>
